From 9aa2d9a549e0dc5a08f765ef4c04b37328a4e787 Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Thu, 28 Apr 2005 15:08:57 +0000 Subject: [PATCH] bitkeeper revision 1.1159.258.107 (4270fc89Gyl1f0UFludQff4kq09XvQ) reboot.c, init.c, hypervisor.h, evtchn.h, tlbflush.h, pgtable-2level.h: sync w/ unstable. system.h: Fix typo. pgtable.h, fixup.c, irq.c, direct.c, timer_tsc.c, pci-dma.c, init.c, fault.c: Cleanup whitespace. page.h: Turn __pte and __pgd into #define's like the original definitions. Add casts to unsigned long for phys_to_machine_mapping and machine_to_phys_mapping. fixmap.h, Makefile: gnttab is not used in 2.0. .del-gnttab.c~4461d10e936c37ab: Delete: linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c .del-gnttab.h~974eaf5d22418ecd: Delete: linux-2.6.11-xen-sparse/include/asm-xen/gnttab.h setup.c: Add panic notification handler. Change phys_to_machine_mapping from unsigned long * to unsigned int *. Whitespace cleanups. page.h: Change phys_to_machine_mapping from unsigned long * to unsigned int *. process.c: UTSNAME -> system_utsname.release as in plain Linux. Disable preemption before reading smp_processor_id. head.S: sync w/ unstable for maintenance -- backport SMP-guest support bits. Break __xen_guest definition up in several lines. ldt.c, desc.h, common.c: Move queue flush into load_LDT(). common.c: g/c unused code. Kconfig: Fix whitespace for microcode option. --- .rootkeys | 2 - linux-2.6.11-xen-sparse/arch/xen/i386/Kconfig | 30 ++-- .../arch/xen/i386/kernel/cpu/common.c | 14 +- .../arch/xen/i386/kernel/head.S | 34 +++- .../arch/xen/i386/kernel/ldt.c | 5 +- .../arch/xen/i386/kernel/pci-dma.c | 41 ++--- .../arch/xen/i386/kernel/process.c | 5 +- .../arch/xen/i386/kernel/setup.c | 38 ++-- .../arch/xen/i386/kernel/timers/timer_tsc.c | 4 +- .../arch/xen/i386/mm/fault.c | 8 +- .../arch/xen/i386/mm/init.c | 23 ++- .../arch/xen/i386/pci/direct.c | 8 +- .../arch/xen/i386/pci/irq.c | 2 +- .../arch/xen/kernel/Makefile | 2 +- .../arch/xen/kernel/fixup.c | 3 +- .../arch/xen/kernel/gnttab.c | 163 ------------------ .../arch/xen/kernel/reboot.c | 8 +- .../include/asm-xen/asm-i386/desc.h | 1 + .../include/asm-xen/asm-i386/fixmap.h | 1 - .../include/asm-xen/asm-i386/page.h | 20 +-- .../include/asm-xen/asm-i386/pgtable-2level.h | 2 +- .../include/asm-xen/asm-i386/pgtable.h | 1 - .../include/asm-xen/asm-i386/system.h | 2 +- .../include/asm-xen/asm-i386/tlbflush.h | 5 - .../include/asm-xen/evtchn.h | 3 - .../include/asm-xen/gnttab.h | 35 ---- .../include/asm-xen/hypervisor.h | 6 + 27 files changed, 138 insertions(+), 328 deletions(-) delete mode 100644 linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c delete mode 100644 linux-2.6.11-xen-sparse/include/asm-xen/gnttab.h diff --git a/.rootkeys b/.rootkeys index e57d34ae76..37b25a42e1 100644 --- a/.rootkeys +++ b/.rootkeys @@ -246,7 +246,6 @@ 41ab6fa06JdF7jxUsuDcjN3UhuIAxg linux-2.6.11-xen-sparse/arch/xen/kernel/devmem.c 40f56238xFQe9T7M_U_FItM-bZIpLw linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c 4110f478aeQWllIN7J4kouAHiAqrPw linux-2.6.11-xen-sparse/arch/xen/kernel/fixup.c -412dfae9eA3_6e6bCGUtg1mj8b56fQ linux-2.6.11-xen-sparse/arch/xen/kernel/gnttab.c 40f562392LBhwmOxVPsYdkYXMxI_ZQ linux-2.6.11-xen-sparse/arch/xen/kernel/reboot.c 414c113396tK1HTVeUalm3u-1DF16g linux-2.6.11-xen-sparse/arch/xen/kernel/skbuff.c 3f68905c5eiA-lBMQSvXLMWS1ikDEA linux-2.6.11-xen-sparse/arch/xen/kernel/xen_proc.c @@ -314,7 +313,6 @@ 40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.11-xen-sparse/include/asm-xen/ctrl_if.h 40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.11-xen-sparse/include/asm-xen/evtchn.h 419b4e9367PjTEvdjwavWN12BeBBXg linux-2.6.11-xen-sparse/include/asm-xen/foreign_page.h -412dfaeazclyNDM0cpnp60Yo4xulpQ linux-2.6.11-xen-sparse/include/asm-xen/gnttab.h 40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h 3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.11-xen-sparse/include/asm-xen/linux-public/privcmd.h 3fa8e3f0kBLeE4To2vpdi3cpJbIkbQ linux-2.6.11-xen-sparse/include/asm-xen/linux-public/suspend.h diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/Kconfig b/linux-2.6.11-xen-sparse/arch/xen/i386/Kconfig index f6dd7b5203..fb421d855d 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/Kconfig +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/Kconfig @@ -456,22 +456,22 @@ config PREEMPT_BKL # enters thermal throttling. config MICROCODE - tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support" + tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support" depends on XEN_PRIVILEGED_GUEST - ---help--- - If you say Y here and also to "/dev file system support" in the - 'File systems' section, you will be able to update the microcode on - Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II, - Pentium III, Pentium 4, Xeon etc. You will obviously need the - actual microcode binary data itself which is not shipped with the - Linux kernel. - - For latest news and information on obtaining all the required - ingredients for this driver, check: - . - - To compile this driver as a module, choose M here: the - module will be called microcode. + ---help--- + If you say Y here and also to "/dev file system support" in the + 'File systems' section, you will be able to update the microcode on + Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II, + Pentium III, Pentium 4, Xeon etc. You will obviously need the + actual microcode binary data itself which is not shipped with the + Linux kernel. + + For latest news and information on obtaining all the required + ingredients for this driver, check: + . + + To compile this driver as a module, choose M here: the + module will be called microcode. #config X86_MSR # tristate "/dev/cpu/*/msr - Model-specific register support" diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/cpu/common.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/cpu/common.c index dc60f9d677..e4092fbc67 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/cpu/common.c +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/cpu/common.c @@ -597,22 +597,11 @@ void __init cpu_init (void) set_in_cr4(X86_CR4_TSD); } - /* - * Initialize the per-CPU GDT with the boot GDT, - * and set up the GDT descriptor: - */ - if (cpu) { - cpu_gdt_descr[cpu].size = GDT_SIZE; - cpu_gdt_descr[cpu].address = 0; /* XXXcl alloc page */ - BUG(); /* XXXcl SMP */ - memcpy((void *)cpu_gdt_descr[cpu].address, - (void *)cpu_gdt_descr[0].address, GDT_SIZE); - } /* * Set up the per-thread TLS descriptor cache: */ memcpy(thread->tls_array, &get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN], - GDT_ENTRY_TLS_ENTRIES * 8); + GDT_ENTRY_TLS_ENTRIES * 8); cpu_gdt_init(&cpu_gdt_descr[cpu]); @@ -633,7 +622,6 @@ void __init cpu_init (void) load_esp0(t, thread); load_LDT(&init_mm.context); - flush_page_update_queue(); /* Clear %fs and %gs. */ asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/head.S b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/head.S index b8ac0568da..0564db4c26 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/head.S +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/head.S @@ -2,7 +2,9 @@ #include .section __xen_guest - .ascii "GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=2.0,VIRT_BASE=0xC0000000" + .ascii "GUEST_OS=linux,GUEST_VER=2.6" + .ascii ",XEN_VER=2.0" + .ascii ",VIRT_BASE=0xC0000000" .ascii ",LOADER=generic" .ascii ",PT_MODE_WRITABLE" .byte 0 @@ -31,14 +33,19 @@ ENTRY(startup_32) cld - /* Set up the stack pointer */ - lss stack_start,%esp - /* Copy the necessary stuff from xen_start_info structure. */ mov $xen_start_info_union,%edi mov $128,%ecx rep movsl +#ifdef CONFIG_SMP +ENTRY(startup_32_smp) + cld +#endif /* CONFIG_SMP */ + + /* Set up the stack pointer */ + lss stack_start,%esp + checkCPUtype: /* get vendor info */ @@ -61,11 +68,22 @@ checkCPUtype: movb %cl,X86_MASK movl %edx,X86_CAPABILITY - xorl %eax,%eax # Clear FS/GS and LDT + incb ready + + xorl %eax,%eax # Clear FS/GS and LDT movl %eax,%fs movl %eax,%gs - cld # gcc2 wants the direction flag cleared at all times - + cld # gcc2 wants the direction flag cleared at all times + +#ifdef CONFIG_SMP + movb ready, %cl + cmpb $1,%cl + je 1f # the first CPU calls start_kernel + # all other CPUs call initialize_secondary + call initialize_secondary + jmp L6 +1: +#endif /* CONFIG_SMP */ call start_kernel L6: jmp L6 # main should never return here, but @@ -88,6 +106,8 @@ ENTRY(stack_start) .long init_thread_union+THREAD_SIZE .long __BOOT_DS +ready: .byte 0 + .globl idt_descr .globl cpu_gdt_descr diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c index 53f0315039..a5a80e4ea7 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/ldt.c @@ -22,10 +22,8 @@ #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) { - if (current->active_mm) { + if (current->active_mm) load_LDT(¤t->active_mm->context); - flush_page_update_queue(); - } } #endif @@ -64,7 +62,6 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / PAGE_SIZE); load_LDT(pc); - flush_page_update_queue(); #ifdef CONFIG_SMP mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c index 8cb2c64959..9df49e66ae 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/pci-dma.c @@ -49,11 +49,11 @@ xen_contig_memory(unsigned long vstart, unsigned int order) /* 1. Zap current PTEs, giving away the underlying pages. */ for (i = 0; i < (1<pte_low >> PAGE_SHIFT; + pgd = pgd_offset_k(vstart + (i*PAGE_SIZE)); + pud = pud_offset(pgd, vstart + (i*PAGE_SIZE)); + pmd = pmd_offset(pud, vstart + (i*PAGE_SIZE)); + pte = pte_offset_kernel(pmd, vstart + (i*PAGE_SIZE)); + pfn = pte_val_ma(*pte) >> PAGE_SHIFT; queue_l1_entry_update(pte, 0); phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = INVALID_P2M_ENTRY; @@ -66,21 +66,19 @@ xen_contig_memory(unsigned long vstart, unsigned int order) &pfn, 1, order) != 1) BUG(); /* 3. Map the new extent in place of old pages. */ for (i = 0; i < (1<>PAGE_SHIFT)+i); - phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = - pfn+i; + pgd = pgd_offset_k(vstart + (i*PAGE_SIZE)); + pud = pud_offset(pgd, vstart + (i*PAGE_SIZE)); + pmd = pmd_offset(pud, vstart + (i*PAGE_SIZE)); + pte = pte_offset_kernel(pmd, vstart + (i*PAGE_SIZE)); + queue_l1_entry_update(pte, + ((pfn+i)<>PAGE_SHIFT)+i); + phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = pfn+i; } /* Flush updates through and flush the TLB. */ xen_tlb_flush(); - balloon_unlock(flags); + balloon_unlock(flags); } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) @@ -125,14 +123,13 @@ void *dma_alloc_coherent(struct device *dev, size_t size, vstart = __get_free_pages(gfp, order); ret = (void *)vstart; - if (ret == NULL) - return ret; - - xen_contig_memory(vstart, order); - memset(ret, 0, size); - *dma_handle = virt_to_bus(ret); + if (ret != NULL) { + xen_contig_memory(vstart, order); + memset(ret, 0, size); + *dma_handle = virt_to_bus(ret); + } return ret; } diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/process.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/process.c index 6500ff9a2c..9a0e5d1322 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/process.c +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/process.c @@ -94,10 +94,11 @@ EXPORT_SYMBOL(enable_hlt); extern int set_timeout_timer(void); void xen_idle(void) { - int cpu = smp_processor_id(); + int cpu; local_irq_disable(); + cpu = smp_processor_id(); if (rcu_pending(cpu)) rcu_check_callbacks(cpu, 0); @@ -167,7 +168,7 @@ void show_regs(struct pt_regs * regs) if (regs->xcs & 2) printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); printk(" EFLAGS: %08lx %s (%s)\n", - regs->eflags, print_tainted(),UTS_RELEASE); + regs->eflags, print_tainted(), system_utsname.release); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx); printk("ESI: %08lx EDI: %08lx EBP: %08lx", diff --git a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c index 5b6b9a69a0..f6096f03b7 100644 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include